<div id="middle">
    <div class="ui-widget-header">
        <div>
            <select id="tableLimit" onchange="setTableRowsPerPage(this.value)">
                <option>25</option>
                <option>50</option>
                <option>100</option>
                <option selected>{$smarty.session.query.rowsPerPage|default:50}</option>
            </select>
        </div>
        <div class="paging">{include file='paging.tpl'}</div>
        <div>
        {if $formRights.create == 1}<a class="gfxButton" id="add" href="index.php?type=form&action=open"></a>{/if}
        </div>
    </div>
    <table class="main" id="{$smarty.session.query.from}">
        <thead>
            <tr>
            {foreach from=$tableHeaders item=item key=key}                    
                <td class="ui-state-default ui-corner-top">
                        <div class="searchWraper">
                            {if $item.search}
                                {include file='search/search.tpl'}
                            {/if}
                        </div>
                        <div class="header columnName" id="columnName-{$item.fieldId}" onclick="setTableOrder(this.id)">
                            <span >{$item.title}</span>
                        </div>
                </td>
            {/foreach}
                {if $formRights.edit == 1}
                <td class="ui-state-default ui-corner-top" colspan="2"><a class="gfxButton" id="multi-delete" href="javascript:multiDelete()"></a></td>
                {/if}
            </tr>
        </thead>
        <tbody id="target">
            {include file="table/rows.tpl"}
        </tbody>
    </table>
    <div class="paging">{include file='paging.tpl'}</div>
</div>